import request from '@/utils/request'

export function getImagesByPage(params) {
  return request({
    url: '/cs/attachments',
    params: params
  })
}

export function deleteFileById(id) {
  return request({
    url: '/cs/attachments',
    method: 'delete',
    params: {
      id: id
    }
  })
}

export function batchDelete(data) {
  return request({
    url: '/cs/attachments?batch=true',
    method: 'delete',
    data: data
  })
}

export function getAttTags() {
  return request({
    url: '/cs/att_tags',
    params: {
      query: 'all'
    }
  })
}

export function addTag(data) {
  return request({
    url: '/cs/att_tags',
    method: 'post',
    data: data
  })
}

export function batchChangeTagId(id, dataList) {
  return request({
    url: '/cs/attachments',
    method: 'put',
    params: {
      target_tag_id: id
    },
    data: dataList
  })
}

//删除类目，并清空类目下所有图片
export function deleteTagAndClearAtts(tagId) {
  return request({
    url: '/cs/att_tags',
    method: 'delete',
    params: {
      id: tagId
    }
  })
}
